import { createApp } from 'vue';
import App from './App.vue';
import router from '@/router/index';
import store from './store';

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import { globalRegister } from './global/index';
import { setupStore } from './store';

import 'normalize.css';
import './assets/css/index.less';

const app = createApp(App);

app.use(store);
setupStore(); // 这个函数必须在router之前使用: // 这个函数的作用是 每次页面刷新 再次执行 store.dispatch('loginModule/loadLocalLoginData');将vuex的数据再次放在localStorage
app.use(router); // 每次刷新也都会重新注册路由

app.use(ElementPlus, {
  locale: zhCn
});
app.use(globalRegister);

app.mount('#app');
console.log(process.env.VUE_APP_BASE_URL);
console.log(process.env.VUE_APP_BASE_NAME);
